package com.unc.allergyex;
import java.util.ArrayList;

import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.view.View;

import com.unc.allergyex.adapters.AboutAdapter;

/**
 * This is the activity for the about class. It is an expandable list view
 * with constant strings as data. It uses the about.xml layout file and the 
 * AboutAdapter as the expandable list adapter.
 * @author Stephanie
 */
public class About extends ExpandableListActivity {
	
	AboutAdapter adapter;
	
	//all of the title strings
	final private String WHAT_IT_DOES_TITLE = "What This App Does";
	final private String CHOOSING_ALLERGIES_TITLE = "Choosing Your Allergies";
	final private String SEARCHING_TITLE = "Searching For Restaurants";
	final private String MAP_SEARCH_TITLE = "Using The Map";
	final private String ABOUT_TITLE = "Who Made This";
	
	//all of the content strings
	final private String WHAT_IT_DOES = "Allows you to search for menus and filter by your food allergies!";
	final private String CHOOSING_ALLERGIES = "On the main screen, select \"Edit Allergies\", then tap the foods you are allergic to!";
	final private String SEARCHING = "On the main screen, type in a restaurant name, then tap \"Search\"!";
	final private String MAP_SEARCH = "On the main screen, tap \"Search Nearby Restaurants\", then tap flags on the map to find out more about pins!";
	final private String ABOUT = "Conceived by Alex Carberry and Brian Serow.  Made by Ryan Miller, Stephanie Zolayvar, Abigail Lind, and Phillip Smith.";
	
	/**
	 * Sets up the About activity.  Generates the content for the 
	 * AboutAdapter using static Strings.  This method is run automatically 
	 * when the About activity is launched.                                 
	 * @param  savedInstanceState  default param for onCreate.  We aren't using this to do anything.                    
	 */
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		
		//set up categories list
		ArrayList<String> categories = new ArrayList<String>();
		categories.add(WHAT_IT_DOES_TITLE);
		categories.add(CHOOSING_ALLERGIES_TITLE);
		categories.add(SEARCHING_TITLE);
		categories.add(MAP_SEARCH_TITLE);
		categories.add(ABOUT_TITLE);
		
		//set up content list
		ArrayList<ArrayList<String>> items = new ArrayList<ArrayList<String>>();
		ArrayList<String> one = new ArrayList<String>();
		one.add(WHAT_IT_DOES);
		items.add(one);
		ArrayList<String> two = new ArrayList<String>();
		two.add(CHOOSING_ALLERGIES);
		items.add(two);
		ArrayList<String> three = new ArrayList<String>();
		three.add(SEARCHING);
		items.add(three);
		ArrayList<String> four = new ArrayList<String>();
		four.add(MAP_SEARCH);
		items.add(four);
		ArrayList<String> five = new ArrayList<String>();
		five.add(ABOUT);
		items.add(five);
		adapter = new AboutAdapter( this, categories, items);
		setListAdapter(adapter);
	}
	
	/**
	 * Causes this activity to close.  This method is called when the back button
	 * is tapped.
	 * @param v default parameter for this method
	 */
	public void backButtonClicked(View v){
		this.finish();
	}
}
